//
//  SLConfig.swift
//  sulit-loan
//
//  Created by 王刚锋 on 2025/4/5.
//  Copyright © 2025 coolBoy. All rights reserved.
//

import Foundation
import UIKit

//屏幕比例
var devWidthRatio: CGFloat {
    DevConfig.width/375
}

struct SLAPIConfig{
    //网络超时时间
    static let connectTimeout = 5000;
    
    //域名地址
    static var baseURL: String {
        //默认地址

        let url = "https://sln.eth-lending.com/eliminating/"
        return url
    }
    static let rootPath = ""
}


struct SLColorConfig{
    static var mainColor: UIColor {
        rgba(hex: "#1608EC")
    }
}
struct DevConfig {
    
    
    static var width: CGFloat {
        return UIScreen.main.bounds.size.width;
    }
    static var heigth: CGFloat {
        return UIScreen.main.bounds.size.height;
    }
    
    static var isIphoneX: Bool {
        let screenBounds = UIScreen.main.bounds
            let screenWidth = screenBounds.width
            let screenHeight = screenBounds.height
            
            if screenWidth >= 375 && screenHeight >= 812 {
                return true
            }
            
            if #available(iOS 11.0, *) {
                if let delegate = UIApplication.shared.delegate as? AppDelegate,
                   let window = delegate.window{
                    let topSafeArea = window.safeAreaInsets.top ?? 0
                    let bottomSafeArea = window.safeAreaInsets.bottom ?? 0
                    
                    if topSafeArea > 20 || bottomSafeArea > 0 {
                        return true
                    }
                }
            }
            
            return false
    }
    static var state_height: CGFloat {
        return isIphoneX ? 44.0 : 20.0
    }
    static var nav_height: CGFloat {
        return 44.0 + state_height;
    }
    static var tab_height: CGFloat {
        return isIphoneX ? 83.0 : 49.0
    }
    static var safe_top: CGFloat {
        return isIphoneX ? 24.0 : 0.0
    }
    static var safe_bottom: CGFloat {
        return isIphoneX ? 34.0 : 0.0
    }
    static var brand: String {
        var systemInfo = utsname()
        uname(&systemInfo)
        let platform = withUnsafePointer(to: &systemInfo.machine.0) { ptr in
            return String(cString: ptr)
        }
        return platform
    }
    static var systemVersion: String {
        return UIDevice.current.systemVersion
    }
    static var appVersion: String {
        return Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
    }
}
struct SLFontConfig {
    static func regular(size:CGFloat = 14)->UIFont{
        return .systemFont(ofSize: size)
    }
    static func bold(size:CGFloat = 14)->UIFont{
        return .systemFont(ofSize: size,weight: .bold)
    }
    static func medium(size:CGFloat = 14)->UIFont{
        return  .systemFont(ofSize: size,weight: .medium)
    }

    static var medium10: UIFont {
        return  .systemFont(ofSize: 10,weight: .medium)
    }
    static var medium11: UIFont {
        return .systemFont(ofSize: 11,weight: .medium)
    }
    static var medium12: UIFont {
        return .systemFont(ofSize: 12,weight: .medium)
    }
    static var medium13: UIFont {
        return .systemFont(ofSize: 13,weight: .medium)
    }
    static var medium14: UIFont {
        return .systemFont(ofSize: 14,weight: .medium)
    }
    static var medium15: UIFont {
        return .systemFont(ofSize: 15,weight: .medium)
    }
    static var medium16: UIFont {
        return .systemFont(ofSize: 16,weight: .medium)
    }
    static var medium17: UIFont {
        return .systemFont(ofSize: 17,weight: .medium)
    }
    static var medium18: UIFont {
        return .systemFont(ofSize: 18,weight: .medium)
    }
    static var medium19: UIFont {
        return .systemFont(ofSize: 19,weight: .medium)
    }
    static var medium20: UIFont {
        return .systemFont(ofSize: 20,weight: .medium)
    }
    static var medium21: UIFont {
        return .systemFont(ofSize: 21,weight: .medium)
    }
    static var medium25: UIFont {
        return .systemFont(ofSize: 25,weight: .medium)
    }
    static var medium33: UIFont {
        return .systemFont(ofSize: 33,weight: .medium)
    }
    static var bold10: UIFont {
        return .systemFont(ofSize: 10,weight: .bold)
    }
    static var bold12: UIFont {
        return .systemFont(ofSize: 12,weight: .bold)
    }
    static var bold13: UIFont {
        return .systemFont(ofSize: 13,weight: .bold)
    }
    static var bold14: UIFont {
        return .systemFont(ofSize: 14,weight: .bold)
    }
    static var bold15: UIFont {
        return .systemFont(ofSize: 15,weight: .bold)
    }
    static var bold16: UIFont {
        return .systemFont(ofSize: 16,weight: .bold)
    }
    static var bold17: UIFont {
        return .systemFont(ofSize: 17,weight: .bold)
    }
    static var bold18: UIFont {
        return .systemFont(ofSize: 18,weight: .bold)
    }
    static var bold19: UIFont {
        return .systemFont(ofSize: 19,weight: .bold)
    }
    static var bold22: UIFont {
        return .systemFont(ofSize: 22,weight: .bold)
    }
    static var bold24: UIFont {
        return .systemFont(ofSize: 24,weight: .bold)
    }
    static var regular11: UIFont {
        return .systemFont(ofSize: 11)
    }
    static var regular12: UIFont {
        return .systemFont(ofSize: 12)
    }
    static var regular13: UIFont {
        return .systemFont(ofSize: 13)
    }
    static var regular14: UIFont {
        return .systemFont(ofSize: 14)
    }
    static var regular15: UIFont {
        return .systemFont(ofSize: 15)
    }
    static var regular16: UIFont {
        return .systemFont(ofSize: 16)
    }
    static var regular17: UIFont {
        return .systemFont(ofSize: 17)
    }
    static var regular18: UIFont {
        return .systemFont(ofSize: 18)
    }
    static var regular19: UIFont {
        return .systemFont(ofSize: 19)
    }
}
